package org.huangrui.redis.iomultiplex.bio.read;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * @Author hr
 * @Create 2024-05-24 00:00
 */
@SuppressWarnings("resource")
public class RedisClient01 {
    public static void main(String[] args) {
        try(
                Socket socket = new Socket("127.0.0.1", 6379);
                OutputStream outputStream = socket.getOutputStream();
        ) {
            while (true){
                Scanner scanner = new Scanner(System.in);
                String next = scanner.next();
                if ("quit".equalsIgnoreCase(next)) {
                    break;
                }
                outputStream.write(next.getBytes());
                System.out.println("------RedisClient01 input quit keyword to finish......");
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
